import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PrivateTeachingScheduleVO, PrivateTeachingScheduleForm, PrivateTeachingScheduleQuery } from '@/api/primary/privateTeachingSchedule/types';

/**
 * 查询私教预定日期列表
 * @param query
 * @returns {*}
 */

export const listPrivateTeachingSchedule = (query?: PrivateTeachingScheduleQuery): AxiosPromise<PrivateTeachingScheduleVO[]> => {
  return request({
    url: '/primary/privateTeachingSchedule/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询私教预定日期详细
 * @param id
 */
export const getPrivateTeachingSchedule = (id: string | number): AxiosPromise<PrivateTeachingScheduleVO> => {
  return request({
    url: '/primary/privateTeachingSchedule/' + id,
    method: 'get'
  });
};
/**
 * 查询私教预定日期详细
 * @param id
 */
export const getcoachcard = (id: string | number): AxiosPromise<PrivateTeachingScheduleVO> => {
  return request({
    url: '/primary/privateTeachingSchedule/getCardList/' + id,
    method: 'get'
  });
};
/**
 * 新增私教预定日期
 * @param data
 */
export const addPrivateTeachingSchedule = (data: PrivateTeachingScheduleForm) => {
  return request({
    url: '/primary/privateTeachingSchedule',
    method: 'post',
    data: data
  });
};

/**
 * 修改私教预定日期
 * @param data
 */
export const updatePrivateTeachingSchedule = (data: PrivateTeachingScheduleForm) => {
  return request({
    url: '/primary/privateTeachingSchedule',
    method: 'put',
    data: data
  });
};

/**
 * 修改私教预定区间日期
 * @param data
 */
export const updatetime = (data: any) => {
  return request({
    url: '/primary/gym/setBusiness',
    method: 'put',
    data: data
  });
};

/**
 * 删除私教预定日期
 * @param id
 */
export const delPrivateTeachingSchedule = (id: string | number | Array<string | number>) => {
  return request({
    url: '/primary/privateTeachingSchedule/' + id,
    method: 'delete'
  });
};
